//
//  UIImage+Category.h
//  LNUniversal
//
//  Created by liu nian on 15/5/25.
//  Copyright (c) 2015年 Liu Nian site:http://iliunian.com. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIImage (Category)
@end

@interface UIImage (Effects)
- (UIImage*)blurredImageBlur:(CGFloat)blurAmount;
- (UIImage *)applyLightEffect;
- (UIImage *)applyExtraLightEffect;
- (UIImage *)applyDarkEffect;
- (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor;
- (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage;

//调用：
//UIImageView *me = [[UIImageView alloc] initWithFrame:CGRectMake(10, 480, 614 ,381)];
//[me setImage:[[UIImage imageNamed:@"me.png"] applyBlurWithRadius:5 tintColor:[UIColor colorWithWhite:1 alpha:0.2] saturationDeltaFactor:1.8 maskImage:nil]];
//[self.view addSubview:me];
@end
@interface UIImage (Ellipse)
//不要边框，只把图片变成圆形
- (UIImage *)ellipseImage:(UIImage *)image withInset:(CGFloat)inset;
- (UIImage *)ellipseImage:(UIImage *)image withInset:(CGFloat)inset size:(CGSize )size;
- (UIImage *)ellipseImage:(UIImage *)image withInset:(CGFloat)inset withBorderWidth:(CGFloat)width withBorderColor:(UIColor*)color;
- (UIImage *)ellipseImage:(UIImage *)image withInset:(CGFloat)inset withBorderWidth:(CGFloat)width withBorderColor:(UIColor*)color size:(CGSize )size;
//TODO:compraseImage
/**
 *  图片压缩
 *
 *  @return 图片
 */
- (UIImage *)imageComprase;
/**
 *  获取一个视图控制器的截屏
 *
 *  @param controller 视图控制器
 *
 *  @return 截图
 */
+ (UIImage *)imgWithVC:(UIViewController *)controller;
/**
 *  使用颜色获取一张图片
 *
 *  @param color 需要的颜色
 *  @param size  尺寸
 *
 *  @return 颜色为color尺寸为size的图片
 */
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size;

/**
 *  图片反转
 *
 *  @param orientation 图片需要反转的方向
 *
 *  @return 反转后的图片
 */
- (UIImage*)imageTransferToOrientation:(UIImageOrientation)orientation;

/**
 *  调整图片的方向
 *
 *  @return 返回一个正常图片方向的图片
 */
- (UIImage *)fixOrientation;
@end

@interface UIImage (Color)

/**
 * 获取种颜色,尺寸为 CGSizeMake(1.0f, 1.0f) 一个UIImage:不透明
 *
 *  @param color 颜色
 *
 *  @return 一个color颜色的uiimage
 */
+ (UIImage *)imageFromContextWithColor:(UIColor *)color;
/**
 *  获取种颜色，一个尺寸，我给你返回一个UIImage:不透明
 *
 *  @param color 颜色
 *  @param size  尺寸
 *
 *  @return 一个color颜色的uiimage
 */
+ (UIImage *)imageFromContextWithColor:(UIColor *)color size:(CGSize)size;

//着色 eg:http://onevcat.com/2013/04/using-blending-in-ios/
- (UIImage *)imageWithTintColor:(UIColor *)tintColor;
- (UIImage *)imageWithGradientTintColor:(UIColor *)tintColor;

@end

@interface UIImage (Device)

/**
 *  保存相册
 *
 *  @param completeBlock 成功回调
 *  @param completeBlock 出错回调
 */

-(void)savedPhotosAlbum:(void(^)())completeBlock failBlock:(void(^)())failBlock;
@end


